<% score = experiment.calculate_score %>
<table>
  <caption>
    <%= experiment.conclusion(score).join(" ") %>
    <% if experiment.active? && !experiment.enabled? %>
      <div class='disabled_info'><%=I18n.t('vanity.experiment_has_been_disabled', name: experiment.default.name)%></div>
    <% end %>
  </caption>
  <% score.alts.each do |alt| %>
    <tr class="<%= "choice" if score.choice == alt %>">
      <td class="option"><%= alt.name.gsub(/^o/, "O") %>:
        <% if alt.default? %>
          <div class='default'><%=I18n.t('vanity.default')%></div>
        <% end %>
      </td>
      <td class="value"><code><%=vanity_h alt.value.to_s %></code></td>
      <td class="value"><%= I18n.t 'vanity.participants', :count=>alt.participants %></td>
      <td class="value"><%= I18n.t 'vanity.converted', :count=>alt.converted %></td>
      <td>
        <%= "%.1f%%" % [alt.conversion_rate * 100] %>
        <%= I18n.t('vanity.best_alternative', :probability=>alt.probability.to_i) if score.method == :bayes_bandit_score %>
        <%= I18n.t('vanity.better_alternative_than', :probability=>alt.difference.to_i, :alternative=>score.least.name) if alt.difference && alt.difference >= 1 %>
      </td>
      <% if experiment.enabled? && experiment.active? && respond_to?(:url_for) %>
        <td class="action">
          <small>
            <% if experiment.showing?(alt) %>
              <%= I18n.t 'vanity.currently_shown' %>
            <% else %>
              <a class="button chooses" title="<%= I18n.t 'vanity.choose_experiment' %>" href="#"
                data-id="<%= experiment.id %>" data-url="<%= url_for(:action=>:chooses, :e=>experiment.id, :a=>alt.id) %>"><%= I18n.t 'vanity.show_me' %></a>
            <% end %>
          </small>
        </td>
        <td class="action">
          <small>
            <% if @to_confirm == alt.id %>
              <%= I18n.t 'vanity.complete_and_confirm_experiment_label', :name=>alt.name %>
              <a class="button chooses" title="<%= I18n.t 'vanity.complete_and_confirm_experiment', name: alt.name %>" href="#"
              data-id="<%= experiment.id %>" data-url="<%= url_for(:action=>:complete, :e=>experiment.id, :a=>alt.id, :confirmed=>alt.id) %>"><%= I18n.t 'vanity.confirm' %></a>
            <% else %>
              <a class="button chooses" title="<%= I18n.t 'vanity.complete_experiment', :name=>alt.name %>" href="#"
              data-id="<%= experiment.id %>" data-url="<%= url_for(:action=>:complete, :e=>experiment.id, :a=>alt.id) %>"><%= I18n.t 'vanity.make_permanent' %></a>
            <% end %>
          </small>
        </td>
      <% end %>
    </tr>
  <% end %>
</table>
